10th international ABINIT developer workshop
May 31 - June 4, 2021 - Smart Working, Lockdown

Use the Space key to navigate through all slides.

NB: AbiPy requires pymatgen but it can be interfaced with other packages (e.g ASE, phonopy, etc) via converters
Using conda and the conda forge channel (recommended):
conda install abipy --channel conda-forge
Recipes for AbiPy and ABINIT are now supported by the conda-forge community thus:
Since conda is not limited to py packages, one can install ABINIT in the same env with:
conda install abinit -c conda-forge
Using pip and python wheels:
pip install abipy --user
From the github repository:
git clone https://github.com/abinit/abipy.git
cd abipy
python setup.py install # or `develop` for development
For further info see http://abinit.github.io/abipy/installation.html
%embed https://abinit.github.io/abipy/index.html
%embed https://abinit.github.io/abipy/gallery/plot_phbands_nkpt_tsmear.html#sphx-glr-gallery-plot-phbands-nkpt-tsmear-py
New Flows and post-processing tools for:
in addition to the standard workflows for GS, DFPT, $GW$, IP optics, Bethe-Salpeter, etc.
NB: There's an ongoing effort to reimplement AbiFlows in terms of the atomate framework. In this talk will mainly discuss the new features implemented in abipy.flowtk.
(contributed by G. Petretto)
Based on py script by A. Romero. ...
Applications:
Example: obtain irreps from DDB using phonopy
For the formalism, see:
scf_input = make_scf_input() # Build input for GS calculation
elast_work = flowtk.ElasticWork.from_scf_input(scf_input,
with_relaxed_ion=True,
with_piezo=True)
from abipy.abio.factories import gs_input
gs_inp = gs_input(structure="si.cif",
pseudos="14si.pspnc",
kppa=None, ecut=None, pawecutdg=None, scf_nband=None, accuracy="normal", spin_mode="polarized",
smearing="fermi_dirac:0.1 eV", charge=0.0, scf_algorithm=None)
gs_inp
multi = abilab.ebands_input(structure="si.cif",
pseudos="14si.pspnc",
ecut=8,
spin_mode="unpolarized",
smearing=None,
dos_kppa=5000)
multi.get_vars_dataframe("kptopt", "iscf", "ngkpt")
| kptopt | iscf | ngkpt | |
|---|---|---|---|
| dataset 0 | 1 | None | [8, 8, 8] |
| dataset 1 | -11 | -2 | None |
| dataset 2 | 1 | -2 | [14, 14, 14] |

elastic_ddb = abilab.abiopen("elastic_DDB")
edata = elastic_ddb.anaget_elastic()
edata.elastic_relaxed
| xx | yy | zz | yz | xz | xy | |
|---|---|---|---|---|---|---|
| Voigt index | ||||||
| xx | 135.262182 | 54.450376 | 38.052927 | 0.00000 | 0.000000 | 0.000000 |
| yy | 54.450376 | 135.262181 | 38.052927 | 0.00000 | 0.000000 | 0.000000 |
| zz | 38.052927 | 38.052926 | 148.211029 | 0.00000 | 0.000000 | 0.000000 |
| yz | 0.000000 | 0.000000 | 0.000000 | 30.55071 | 0.000000 | 0.000000 |
| xz | 0.000000 | 0.000000 | 0.000000 | 0.00000 | 30.550709 | 0.000000 |
| xy | 0.000000 | 0.000000 | 0.000000 | 0.00000 | 0.000000 | 40.405903 |
edata.get_elastic_properties_dataframe(properties_as_index=True)
| property | 0 | 1 | |
|---|---|---|---|
| 0 | trans_v | 3.194459e+03 | 3.838052e+03 |
| 1 | long_v | 5.796035e+03 | 6.295200e+03 |
| 2 | snyder_ac | 5.767044e+01 | 8.693459e+01 |
| 3 | snyder_opt | 3.158141e-01 | 3.621134e-01 |
| 4 | snyder_total | 5.798626e+01 | 8.729670e+01 |
| 5 | clarke_thermalcond | 7.734051e-01 | 9.006348e-01 |
| 6 | cahill_thermalcond | 8.539415e-01 | 9.791319e-01 |
| 7 | debye_temperature | 3.760623e+02 | 4.477874e+02 |
| 8 | k_voigt | 7.553865e+01 | 7.553930e+01 |
| 9 | k_reuss | 7.553074e+01 | 7.553579e+01 |
| 10 | k_vrh | 7.553469e+01 | 7.553754e+01 |
| 11 | g_voigt | 3.951341e+01 | 5.767416e+01 |
| 12 | g_reuss | 3.761300e+01 | 5.366047e+01 |
| 13 | g_vrh | 3.856321e+01 | 5.566731e+01 |
| 14 | universal_anisotropy | 2.527308e-01 | 3.740360e-01 |
| 15 | homogeneous_poisson | 2.818554e-01 | 2.041909e-01 |
| 16 | y_mod | 9.886491e+10 | 1.340681e+11 |
scf_input = make_scf_input() # Build input for GS calculation
# NB: k-mesh in gs_inp and ngqpt q-mesh must be commensurate.
from abipy.flowtk.gruneisen import GruneisenWork
voldelta = gs_inp.structure.volume * 0.02
work = GruneisenWork.from_gs_input(gs_inp, voldelta, ngqpt=[2, 2, 2], with_becs=False)

gruns = abiopen("out_GRUNS.nc")
gruns.plot_gruns_scatter();
abiopen.py out_GRUNS.nc --expose-web #

(contributed by F. Naccarato)
For the formalism see:
scf_input = make_scf_input() # Get the SCF input (without SOC)
scf_input = make_scf_input()
return flowtk.NonLinearCoeffFlow.from_scf_input("nlo_flow", scf_input)

For the formalism see:
scf_input = make_scf_input() # Get the SCF input (without SOC)
from abipy.flowtk.effmass_works import EffMassAutoDFPTWork
flow = flowtk.Flow("effmass_flow")
work = EffMassAutoDFPTWork.from_scf_input(scf_input)
flow.register_work(work)

This example shows how to compute the e-ph matrix elements in AlAs along a q-path with AbiPy flows. The final results are stored in the GKQ.nc file (one file for q-point) in the outdata of each task.
# Build input for GS calculation on a 2x2x2 k-mesh
scf_input = make_scf_input(ngkpt=(2, 2, 2))
# q-mesh for phonons
ngqpt = (2, 2, 2)
# Create flow to compute all the independent atomic perturbations
# Use ndivsm = 0 to pass an explicit list of q-points.
# If ndivsm > 0, qpath_list is interpreted as a list of boundaries for the q-path
qpath_list = [[0.0, 0.0, 0.0], [0.01, 0, 0], [0.1, 0, 0],
[0.24, 0, 0], [0.3, 0, 0], [0.45, 0, 0], [0.5, 0.0, 0.0]]
from abipy.flowtk.eph_flows import GkqPathFlow
flow = GkqPathFlow.from_scf_input("flow_dir", scf_input,
ngqpt, qpath_list, ndivsm=0, with_becs=True,
ddk_tolerance={"tolwfr": 1e-8})
Formalism:
https://abinit.github.io/abipy/flow_gallery/run_gkq.html#sphx-glr-flow-gallery-run-gkq-py



Several other plotting libraries are available in the pydata ecosystem
gsr = abiopen("si_nscf_GSR.nc")
gsr.ebands.plot(with_gaps=True);
(contributed by Y. He and MG)
gsr.ebands.plotly(with_gaps=True); # object.plot becomes object.plotly
gsr.ebands.kpoints.plotly();
gsr.ebands.kpoints.plot();


To build a panel GUI inside the notebook, invoke the get_panel method:
ddb = abilab.abiopen("ZnSe_hex_qpt_DDB")
abilab.abipanel(); # Important
ddb.get_panel()
ddb.structure.get_panel()
get_panel inside a notebook is great if you need both the flexibility of the python language
and the easiness of the GUIs to improve your productivity. abiopen.py mgb2_kpath_FATBANDS.nc --expose --seaborn
abiopen.py mgb2_kpath_FATBANDS.nc --expose-web # -ewb
abiopen.py mgb2_kpath_FATBANDS.nc --plotly # -ply

To create a panel dashboard associated to the DDB file, use:
abiopen.py out_DDB --panel # or -pn if you prefer the short version.

to get a quick look at the results
abiview.py ddb ZnSe_hex_qpt_DDB --panel # or -pn if you prefer the short version.
%embed https://abinit.github.io/abipy/graphical_interface.html
Use AbiPy programmatic interface to implement: